// Promise和async/await是常见的异步编程方式

//Promise
function promise(){
    return new Promise((resolve,reject)=>{
        setTimeout(()=>{
            resolve('done');
        },1000);
    })
}
promise().then((res)=>console.log(res));


//async/await
async function asyncFunc(){
    const result=await promise();
    console.log(result,11);
}
asyncFunc();


//事件循环
console.log('start');
setTimeout(()=>{
    console.log('setTimeout');
},0)

Promise.resolve().then(()=>console.log('promise'));
console.log('end')